import { AntdDrawer } from '@/components/eai-design';
import TestChatBox from '@/pages/know-gov/sub-pages/govern/components/TestChatBox';
import { useEffect, useState } from 'react';

interface DrawerViewProps {
  open: boolean;
  onClose: () => void;
  keyQuestionText: string;
  keyQuestionQaId: string;
}

const DrawerView = ({ open, onClose, keyQuestionText, keyQuestionQaId }: DrawerViewProps) => {
  const [showTestDrawer, setTestDrawer] = useState(false);

  useEffect(() => {
    setTestDrawer(open);
  }, [open]);

  return (
    <div>
      <AntdDrawer
        title="测试"
        placement="right"
        width={'50%'}
        onClose={onClose}
        open={showTestDrawer}
      >
        <div className="h-full bg-[#edeff7] p-2">
          <TestChatBox
            open={showTestDrawer}
            initChatId={keyQuestionQaId}
            initChatMessage={keyQuestionText}
          />
        </div>
      </AntdDrawer>
    </div>
  );
};

export default DrawerView;
